package com.org.service.impl;

import com.org.mapper.ContentBgMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Random;

/**
 * @author Rainy-Heights
 * @version 1.0
 * @Date 2023/3/11 17:56
 */
@Service
public class GetBgIdServiceImpl {

    @Resource
    ContentBgMapper contentBgMapper;

    //生成指定范围的图片地址,添加到前端
    public String getBgAddress(){
        String location="";
        Random random=new Random();
        int id=random.nextInt(contentBgMapper.getBgNum()-1)+1;
        location="../static/contentbg/"+id+".jpeg";
        return location;
    }
}
